import java.util.Scanner;

/**
 * @author gao
 * @date 2025/9/1 14:37
 */

public class Solution {
    public boolean CheckPermutation(String s1, String s2) {
        if (s1.length() != s2.length()) {
            return false;
        }
        int[] hash = new int[26];

        // 统计s1中每个字符出现的次数
        for (int i = 0; i < s1.length(); i++) {
            hash[s1.charAt(i) - 'a']++;
        }

        for (int i = 0; i < s2.length(); i++) {
            hash[s2.charAt(i) - 'a']--;
            if (hash[s2.charAt(i) - 'a'] < 0) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String s1 = in.nextLine();
            String s2 = in.nextLine();
            Solution solution = new Solution();
            System.out.println(solution.CheckPermutation(s1, s2));
        }
    }
}